if domain.getDomid() is not None:
sxpr.append(['domid', domain.getDomid()])
- if not legacy_only:
+ if legacy_only:
+ sxpr.append(['cpu_weight', int(self['vcpus_params'].get('weight', 256))])
+ sxpr.append(['cpu_cap', int(self['vcpus_params'].get('cap', 0))])
+ else:
for name, typ in XENAPI_CFG_TYPES.items():
if name in self and self[name] not in (None, []):
if typ == dict:
if self.has_key(legacy) and self[legacy] not in (None, []):
sxpr.append([legacy, self[legacy]])
- if self.has_key('vcpus_params'):
- sxpr.append(['cpu_weight', int(self['vcpus_params'].get('weight', 256))])
- sxpr.append(['cpu_cap', int(self['vcpus_params'].get('cap', 0))])
-
if self.has_key('security_label'):
sxpr.append(['security_label', self['security_label']])
# we just ignore it so that the domain can still be restored
log.warn("Cannot restore CPU affinity")
+ self._setSchedParams()
self._storeVmDetails()
self._createChannels()
self._createDevices()
raise VmError("Cpu cap out of range, valid range is from 0 to %s for specified number of vcpus" %
(self.getVCpuCount() * 100))
- xc.sched_credit_domain_set(self.domid, weight, cap)
-
# Test whether the devices can be assigned with VT-d
self.info.update_platform_pci()
pci = self.info["platform"].get("pci")
for v in range(0, self.info['VCPUs_max']):
xc.vcpu_setaffinity(self.domid, v, cpumask)
+ def _setSchedParams(self):
+ if XendNode.instance().xenschedinfo() == 'credit':
+ from xen.xend import XendDomain
+ XendDomain.instance().domain_sched_credit_set(self.getDomid(),
+ self.getWeight(),
+ self.getCap())
def _initDomain(self):
log.debug('XendDomainInfo.initDomain: %s %s',
# distribution for NUMA systems.
self._setCPUAffinity()
+ # Set scheduling parameters.
+ self._setSchedParams()
+
# Use architecture- and image-specific calculations to determine
# the various headrooms necessary, given the raw configured
# values. maxmem, memory, and shadow are all in KiB.